package com.hx.base.others;

/**
 * @author jxlgcmh
 * @create 2019-06-22 15:38
 */
public class Test02 {
    public static void main(String[] args) {

        // status测试

        Status close = Status.CLOSE;
        Status normal = Status.NORMAL;
        System.out.println(close instanceof Status);
        System.out.println(close.get__id__());


//		int[] arr = {1};
//		System.out.println(rob(arr));
    }

    /**
     * 这个算法不行，需要能够动态的跳动，一下跳好几个，随机的，只要间隔大于2就行
     * 这好像我上次遇到的题
     *
     * @param arr
     * @return
     */
    public static int rob(int[] arr) {
        int len = arr.length;
        int sum = 0;
        int res = 0;
        for (int k = 0; k < len; k++) {
            for (int p = 0; p < len; p++) {
                for (int i = k; i < len; ) {
                    sum += arr[i];
                    i += p + 2;
                }
                if (sum > res) {
                    res = sum;
                    //置回0
                    sum = 0;
                } else {
                    sum = 0;
                }
            }

        }
        return res;
    }
}
